When linking a sound object file, if you use linker script, it allows you
more freedom for memory use. An example is
provided below. |
*Example of placing the work area for sound functions in external RAM,
and placing the program in high speed internal RAM. |
(1)First of all, make the default linker script for the development environment into a file (temporary name: ldscript.x).(From command line) ld --verbose > ldscript.x |
(2)Add "-Tldscript.x" to LDFLAGS of the "Makefile".(Example) LDFLAGS += -Map $(MAPFILE) -nostartfiles \ -Ttext 0x08000000 -Tbss 0x03000000 -Tldscript.x \ -L../AgbLib -lagbsyscall -lisagbprn |
(3)Delete the first 5 lines and last line of "ldscript.x".(*=Unnecessary lines) * GNU ld version 2.9-arm-000512 (with BFD 2.9-arm-000512) * Supported emulations: * armelf * using internal linker script: * ================================================== OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(_start) ...Omitted... .stack 0x80000 : { _stack = .; *(.stack) } /* These must appear regardless of . */ } * ================================================== |
(4)Add the following description to the start of the SECTIONS instruction for "ldscript.x".
(*=Added lines) SECTIONS { * .bss.soundwork 0x0203e000 : * { * SoundDir/m4aLib.o(.bss) * SoundDir/SoundDat.o(.bss) * SoundDir/m4aLib.o(COMMON) * SoundDir/SoundDat.o(COMMON) * } * .bss.soundcode 0x03007000 : * { * SoundDir/m4aLib.o(.bss.code) * } /* Read-only sections, merged into text segment: */ . = 0x8000; ...Omitted following * Among the added lines, SoundDir is the directory where the sound object exists so change to an appropriate name. * Specify a location so addresses do not conflict with other areas such as 0x0203e000 and 0x03007000. * With LDFLAGS for the "Makefile" if you have specified "-Tbss 0x02000000", the .bss.soundwork block can be omitted. Or if "-Tbss 0x03000000" is specified, the .bss.soundcode block can be omitted. |
(5) Complete the process by using "make" with the preceding information. |
Next:[
AGB System Sound Circuits(Other useful background information)] Back:[ Using Sound Code in System ROM ] Top :[ Table of Contents ] |